home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / system / bsvc-1.000 / bsvc-1 / bsvc-1.0.4 / src / Framework / BasicCPU.hxx < prev    next >
Encoding:
Text File  |  1995-07-26  |  3.7 KB  |  124 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. // $Id: BasicCPU.hxx,v 1.1 1994/02/18 19:47:58 bmott Exp $
  3. ///////////////////////////////////////////////////////////////////////////////
  4. // BasicCPU.hxx
  5. //
  6. // This is the abstract base class for all microprocessors (CPU)
  7. //
  8. //
  9. // BSVC "A Microprocessor Simulation Framework"
  10. // Copyright (c) 1993
  11. // By: Bradford W. Mott
  12. // June 27,1993
  13. //
  14. ///////////////////////////////////////////////////////////////////////////////
  15. // $Log: BasicCPU.hxx,v $
  16. // Revision 1.1  1994/02/18  19:47:58  bmott
  17. // Initial revision
  18. //
  19. ///////////////////////////////////////////////////////////////////////////////
  20.  
  21. #ifndef BASICCPU_HXX
  22. #define BASICCPU_HXX
  23.  
  24. #include "String.h"
  25.  
  26. class BasicCPU;
  27.  
  28. #include "AddressSpace.hxx"
  29. #include "Event.hxx"
  30. #include "RegInfo.hxx"
  31. #include "StatInfo.hxx"
  32.  
  33. class RegisterInformationList;
  34. class StatisticalInformationList;
  35.  
  36. ///////////////////////////////////////////////////////////////////////////////
  37. // BasicCPU class declaration
  38. ///////////////////////////////////////////////////////////////////////////////
  39. class BasicCPU {
  40.   private:
  41.     // Name of the CPU
  42.     const char *name;
  43.  
  44.     // Number of address spaces in the CPU
  45.     const int number_of_address_spaces;
  46.  
  47.     // Granularity of the CPU in bytes
  48.     const int granularity;
  49.  
  50.     // Record format returned from the ExecuteInstruction function
  51.     const char *execution_trace_record;
  52.  
  53.     // Default fields of the trace record that should be displayed by UI
  54.     const char *default_execution_trace_entries;
  55.  
  56.   public:
  57.     // CPU's Event Handler
  58.     EventHandler  events;
  59.  
  60.     // Pointer to the array of address space objects
  61.     AddressSpace  *address_space;
  62.  
  63.     BasicCPU(const char* n, const int g, const int a,
  64.              AddressSpace *addr, const char* trace,
  65.              const char* default_trace) 
  66.         : name(n),
  67.           granularity(g),
  68.           number_of_address_spaces(a),
  69.           address_space(addr),
  70.           execution_trace_record(trace),
  71.           default_execution_trace_entries(default_trace)
  72.     {};
  73.  
  74.     // Return the name of the microprocessor
  75.     inline const char *Name()
  76.     { return(name); }
  77.  
  78.     // Return the granularity of the microprocessor
  79.     inline int Granularity()
  80.     { return(granularity); }
  81.  
  82.     // Return the number of address spaces used by the processor
  83.     inline const int NumberOfAddressSpaces()
  84.     { return(number_of_address_spaces); }
  85.  
  86.     // Return the execution trace record
  87.     inline const char* ExecutionTraceRecord()
  88.     { return(execution_trace_record); }
  89.  
  90.     // Return the default execution trace entries
  91.     inline const char* DefaultExecutionTraceEntries()
  92.     { return(default_execution_trace_entries); }
  93.  
  94.  
  95.     // Execute the next instruction (NULL or pointer to error message)
  96.     virtual const char* ExecuteInstruction(String& trace_record, int trace_flag)=0;
  97.  
  98.     // Handle an interrupt request from a device
  99.     virtual void InterruptRequest(BasicDevice* device, int level)=0;
  100.  
  101.     // Perform a system reset
  102.     virtual void Reset()=0;
  103.  
  104.     // Return the name of the program counter register (usually "PC")
  105.     virtual char* const NameOfProgramCounter()=0; 
  106.  
  107.     // Return the value of the program counter register
  108.     virtual unsigned long ValueOfProgramCounter()=0;
  109.  
  110.     // Set the named register to the given hexidecimal value
  111.     virtual void SetRegister(String name, String hex_value)=0;
  112.  
  113.     // Clear the CPU's Statistics
  114.     virtual void ClearStatistics()=0;
  115.  
  116.     // Append all of the CPU's registers to the RegisterInformationList object
  117.     virtual void BuildRegisterInformationList(RegisterInformationList*)=0;
  118.  
  119.     // Append all of the CPU's stats to the StatisticalInformationList object
  120.     virtual void BuildStatisticalInformationList(StatisticalInformationList*)=0;
  121. };
  122. #endif
  123.  
  124.